<?php
/**
 * Note: *
 */
namespace App\Models\Game\Center;

use App\Traits\ModelTrait;

class SourceLtvDetail extends Base
{
    use ModelTrait;

    public $table = 'source_ltv_detail';

    public $timestamps = false;

    public $fillable = [
        'regDay',
        'source',
        'dataDay',
        'pay',
        'payUser',
        'withdraw',
        'withdrawUser',
        'thirdExchange',
        'thirdExchangeUser',
        'loginUser',
        'spreadUser',
    ];

    protected $appends = [

        'normalProfit',
        'platformProfit',
    ];

    /**
     * 净利润
     * @return float
     */
    public function getNormalProfitAttribute(): float
    {
        return $this->pay - $this->withdraw - $this->spreadCost;
    }

    /**
     * 平台毛利
     * @return float
     */
    public function getPlatformProfitAttribute(): float
    {
        return $this->pay - $this->withdraw;
    }
}
